import Vue from 'vue';
import Router from 'vue-router';
Vue.use(Router);

import {BASE_PATH} from "../common/api";

export default new Router({
  mode: 'history',
  base: BASE_PATH,
  routes: [
    {
      path: '/',
      component: () => import('../views/Home'),
      children: [
        {
          path: '',
          component: () => import('../views/Main'),
          redirect: {name: 'Main'}
        },
        {
          path: '/main',
          component: () => import('../views/Main'),
          name: 'Main',
          meta: {
            title: APP_NAME,
            authentication: 'login',
            keepAlive: false
          }
        },
        {
          path: '/admin/lists',
          component: () => import('../views/admin/Lists'),
          name: 'AdminLists',
          meta: {
            title: '管理员',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/admin/add',
          component: () => import('../views/admin/Form'),
          name: 'AdminAdd',
          meta: {
            title: '管理员',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/admin/edit/:id',
          component: () => import('../views/admin/Form'),
          name: 'AdminEdit',
          meta: {
            title: '管理员',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/admin/password',
          component: () => import('../views/admin/Password'),
          name: 'AdminPassword',
          meta: {
            title: '修改密码',
            authentication: 'login',
            keepAlive: false
          }
        },
        {
          path: '/resource/lists',
          component: () => import('../views/resource/Lists'),
          name: 'ResourceLists',
          meta: {
            title: '资源管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/resource/add',
          component: () => import('../views/resource/Form'),
          name: 'ResourceAdd',
          meta: {
            title: '添加资源',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/role/lists',
          component: () => import('../views/role/Lists'),
          name: 'RoleLists',
          meta: {
            title: '角色管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/role/add',
          component: () => import('../views/role/Form'),
          name: 'RoleAdd',
          meta: {
            title: '角色管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/role/edit/:id',
          component: () => import('../views/role/Form'),
          name: 'RoleEdit',
          meta: {
            title: '角色管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/role/resources/:roleId',
          component: () => import('../views/role/Resources'),
          name: 'RoleResources',
          meta: {
            title: '权限设置',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/user/login',
          component: () => import('../views/user/Login'),
          name: 'UserLogin',
          meta: {
            title: APP_NAME,
            authentication: 'non',
            keepAlive: false
          }
        },
        {
          path: '/setting/index',
          component: () => import('../views/setting/Index'),
          name: 'SettingIndex',
          meta: {
            title: '设置',
            authentication: 'login',
            keepAlive: false
          }
        },
        {
          path: '/adv/lists',
          component: () => import('../views/adv/Lists'),
          name: 'AdvLists',
          meta: {
            title: '广告',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/adv/add',
          component: () => import('../views/adv/Form'),
          name: 'AdvAdd',
          meta: {
            title: '添加广告',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/adv/edit/:id',
          component: () => import('../views/adv/Form'),
          name: 'AdvEdit',
          meta: {
            title: '编辑广告',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/adv/position',
          component: () => import('../views/adv/Position'),
          name: 'AdvPosition',
          meta: {
            title: '广告位',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/setting/site_config',
          component: () => import('../views/setting/SiteConfig'),
          name: 'SiteConfig',
          meta: {
            title: '系统设置',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/activity/lists',
          component: () => import('../views/activity/Lists'),
          name: 'ActivityLists',
          meta: {
            title: '线下活动',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/activity/add',
          component: () => import('../views/activity/Form'),
          name: 'ActivityAdd',
          meta: {
            title: '线下活动',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/activity/edit/:id',
          component: () => import('../views/activity/Form'),
          name: 'ActivityEdit',
          meta: {
            title: '线下活动',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/activity/apply/:activityId',
          component: () => import('../views/activity/Apply'),
          name: 'ActivityApply',
          meta: {
            title: '线下活动报名管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member/lists',
          component: () => import('../views/member/Lists'),
          name: 'MemberLists',
          meta: {
            title: '会员管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member/add',
          component: () => import('../views/member/Form'),
          name: 'MemberAddForm',
          meta: {
            title: '会员管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member/edit/:profile_id',
          component: () => import('../views/member/Form'),
          name: 'MemberEditForm',
          meta: {
            title: '会员管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member/images/:user_id',
          component: () => import('../views/member/Images'),
          name: 'MemberImages',
          meta: {
            title: '会员相册',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member_auth/lists',
          component: () => import('../views/member/auth/Lists'),
          name: 'MemberAuthLists',
          meta: {
            title: '审核管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member_auth/user_avatar',
          component: () => import('../views/member/auth/UserAvatar'),
          name: 'MemberAuthUserAvatar',
          meta: {
            title: '用户头像',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member_auth/member_photo',
          component: () => import('../views/member/auth/MemberPhoto'),
          name: 'MemberAuthMemberPhoto',
          meta: {
            title: '形象照',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member_auth/member_image',
          component: () => import('../views/member/auth/MemberImage'),
          name: 'MemberAuthMemberImage',
          meta: {
            title: '会员照片',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member_friend_apply/lists',
          component: () => import('../views/member/friend_apply/Lists'),
          name: 'MemberFriendApplyLists',
          meta: {
            title: '交友申请管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/member_complaint/lists',
          component: () => import('../views/member/complaint/Lists'),
          name: 'MemberComplaintLists',
          meta: {
            title: '投诉管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/withdraw/lists',
          component: () => import('../views/withdraw/Lists'),
          name: 'WithdrawLists',
          meta: {
            title: '提现管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/course/lists',
          component: () => import('../views/course/Lists'),
          name: 'CourseLists',
          meta: {
            title: '课程管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/course/add',
          component: () => import('../views/course/Form'),
          name: 'CourseAdd',
          meta: {
            title: '课程管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/course/edit/:id',
          component: () => import('../views/course/Form'),
          name: 'CourseEdit',
          meta: {
            title: '课程管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/course_order/lists',
          component: () => import('../views/course/order/Lists'),
          name: 'CourseOrderLists',
          meta: {
            title: '课程订单管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/course_order/detail/:sn',
          component: () => import('../views/course/order/Detail'),
          name: 'CourseOrderDetail',
          meta: {
            title: '课程订单管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/service_package/lists',
          component: () => import('../views/service_package/Lists'),
          name: 'ServicePackageLists',
          meta: {
            title: '服务套餐',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/service_package/add',
          component: () => import('../views/service_package/Form'),
          name: 'ServicePackageAdd',
          meta: {
            title: '服务套餐',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/service_package/edit/:id',
          component: () => import('../views/service_package/Form'),
          name: 'ServicePackageEdit',
          meta: {
            title: '服务套餐',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/service_package_order/lists',
          component: () => import('../views/service_package/order/Lists'),
          name: 'ServicePackageOrderLists',
          meta: {
            title: '服务套餐-订单',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/service_package_order/detail/:sn',
          component: () => import('../views/service_package/order/Detail'),
          name: 'ServicePackageOrderDetail',
          meta: {
            title: '服务套餐-订单',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/platform_account_book/lists',
          component: () => import('../views/platform_account_book/Lists'),
          name: 'PlatformAccountBookLists',
          meta: {
            title: '平台收支',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/marketing/index',
          component: () => import('../views/marketing/Index'),
          name: 'MarketingIndex',
          meta: {
            title: '营销',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/marketing_vip_card/create',
          component: () => import('../views/marketing/vip_card/Form'),
          name: 'MarketingCreateVipCard',
          meta: {
            title: '创建会员卡',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/marketing_vip_card/edit/:id',
          component: () => import('../views/marketing/vip_card/Form'),
          name: 'MarketingEditVipCard',
          meta: {
            title: '创建会员卡',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/marketing_vip_card/no/:vip_card_id',
          component: () => import('../views/marketing/vip_card/No'),
          name: 'MarketingVipCardNo',
          meta: {
            title: '卡号管理',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/marketing_activity/create',
          component: () => import('../views/marketing/activity/Form'),
          name: 'MarketingCreateActivity',
          meta: {
            title: '创建营销活动',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/marketing_activity/edit/:id',
          component: () => import('../views/marketing/activity/Form'),
          name: 'MarketingEditActivity',
          meta: {
            title: '创建营销活动',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/marketing_activity/lists',
          component: () => import('../views/marketing/activity/Lists'),
          name: 'MarketingActivityLists',
          meta: {
            title: '营销活动',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/marketing_activity/joiner/:activity_id',
          component: () => import('../views/marketing/activity/Joiner'),
          name: 'MarketingActivityJoiner',
          meta: {
            title: '营销活动-参与人',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/matchmaker/lists',
          component: () => import('../views/matchmaker/Lists'),
          name: 'MatchmakerLists',
          meta: {
            title: '红娘',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/matchmaker/recommend/:userId',
          component: () => import('../views/matchmaker/Recommend'),
          name: 'MatchmakerRecommend',
          meta: {
            title: '推荐记录',
            authentication: 'role',
            keepAlive: false
          }
        },
        {
          path: '/matchmaker/salary/:userId',
          component: () => import('../views/matchmaker/Salary'),
          name: 'MatchmakerSalary',
          meta: {
            title: '推广收益',
            authentication: 'role',
            keepAlive: false
          }
        }
      ]
    },
    {
      path: '/404',
      component: () => import('../components/404'),
      name: 'NotFound',
      meta: {
        title: '找不到页面',
        authentication: 'non',
        keepAlive: false
      }
    },
    {
      path: '/unauthorized',
      component: () => import('../components/Unauthorized'),
      name: 'Unauthorized',
      meta: {
        title: '未授权',
        authentication: 'non',
        keepAlive: false
      }
    },
    {
      path: '*',
      redirect: {path: '/404'}
    }
  ]
})
